Resources are data assets used by objects and other resources as property values. For example, a mesh is an object, which uses mesh data resource that defines its geometry. The mesh data refers to a material resource which defines the surface material of the mesh, while a textured material refers to a texture resource.
In Kanzi these items are resources and you can make them local:
All resources are global by default when imported or created into the project. They can be used as values for project items’ resource properties such as texture, material, and so on.
You can make resources local using the Context Resources. Adding a resource to a certain object’s scope adds a resource ID entry to that object’s resource dictionary.
A resource ID is an identifier that abstracts an actual resource from where it is used. A resource dictionary is a collection of resource IDs pointing to actual resources. Resource dictionaries are present by default in all prefab roots but can be added to any object by assigning the resource dictionary property. An object sees all IDs defined in its own dictionary and in dictionaries defined in its ascendant objects. You can assign Resource IDs as values for resource properties and are shown in Kanzi Studio using the syntax RscID → Resource.
See Using local and global resources.
The advantages of local resources:
Resources listed in the Context Resources have a resource ID. The resource dictionary target object is the resource item in the project. This allows:
Use external scopes when you want to be able to use the drop-down menus to select the resources from external resource dictionaries, but do not want to add them to the context of an object. This is useful when you use actions or application code to change the scene graph.
For example, a prefab defines its individual set of resources. When Kanzi instantiates the prefab as a part of the Screen object, all resources defined in the Screen’s resource dictionary become visible to the prefab. Having the Screen as an external resource dictionary for the prefab allows selecting the Screen’s resources as property values even when the prefab is edited outside the Screen’s context (the prefab template itself which is not under the Screen).
If a prefab instance is always instantiated inside a specific scene in a project, you can add that scene as an external resource dictionary.
See Using external resource dictionaries.
All resources go through the following steps during the application development:
Additioanlly, during runtime, Kanzi applications access the GPU resources from the .kzb file based on the value of the GPU Memory Type property. The resource is loaded from the kzb into RAM when the resource is first required by the Project object (usually when the object is attached to the visible graph).
If required, manipulation or decompression of the resource is applied at this point. With the GPU Memory Type property you can define how your Kanzi application handles the GPU resources:
In the Kanzi API, the GPU Memory Type property corresponds to the following resource loading and deployment strategies:
Using local and global resources
Using external resource dictionaries